package open.witype.filetiper.custom;

import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by Typer on 2015/5/11 0011.
 * 自定义RecyclerView
 */
public class DragRecyclerView extends RecyclerView {

    private ViewGroup emptyView;

    public DragRecyclerView(Context context) {
        this(context,null);
    }

    public DragRecyclerView(Context context, AttributeSet attrs) {
        super(context, attrs);
        LinearLayoutManager manager = new LinearLayoutManager(context);
        manager.setOrientation(LinearLayoutManager.VERTICAL);
        setLayoutManager(manager);
    }

    public void setEmptyView(ViewGroup view){
        this.emptyView = view;
        ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        emptyView.setVisibility(View.GONE);
        addView(emptyView,layoutParams);
    }

    private View showEmptyView(){
        emptyView.setVisibility(View.VISIBLE);
        return emptyView;
    }

    public void dimissEmptyView(){
        emptyView.setVisibility(View.GONE);
    }
}
